BlueCielo Publisher 2012 Administrator's Guide | BlueCielo ECM Solutions

You are here: Registering documents for publication > Registering programmatically without the Task Server

Registering programmatically without the Task Server

Registering without the Task Server involves bypassing the Task Server and creating entries directly in the Publisher database. Entries can be created by using the MeridianQueue object from within VBScript, a PowerUser user interface extension, or a .NET application.

Registering without using the Task Server has the following advantage:

These advantages simplify your system configuration. However, the disadvantage of registering without the Task Server is that it requires more complicated programing on your part to register documents for publishing. For information about programmatically registering documents using the Task Server, see Registering programmatically with the Task Server.

You can take any one of the following approaches to creating the database records:

To register documents without using the Task Server:

  1. Call the RegisterDocument method of the MeridianQueue object and pass at least a Document object and JobCode (publish code) property as shown in the following examples. For more information about the MeridianQueue object, see About the MeridianQueue object.

The task can be submitted by any event or command where a Document object exists. For more information about the Submit method, see the BlueCielo Meridian Enterprise VBScript API Reference.

Note In VBScript, you only have access to the current document; therefore, publishing tasks can only be created for the current document.

Example using Meridian Enterprise VBScript
Sub PublishCommand_Execute(Batch)
  'Create the script object.
  Set Publisher = New PublisherScriptObject  
  'Register the current document for publishing.
  Call Publisher.Queue.RegisterDocument("", "3BA9DF", Document.ID, , , , , , "Custom.PublishStatus")
  'Release the script object.
  Set Publisher = Nothing    
End Sub

'Represents a wrapper of a COM object accessible from VBScript.
'Provides deterministic release of resources.
Class PublisherScriptObject
  Private underlyingObject

  'Initializes the COM object.
  Private Sub Class_Initialize()
      Set underlyingObject = AMCreateObject("BCPublisher.MeridianQueue")
    End Sub

  'Releases the COM object.
  Private Sub Class_Terminate()
      underlyingObject.Dispose()
        Set underlyingObject = Nothing
  End Sub

  'Gets the COM object.
  Public Property Get Queue
    Set Queue = underlyingObject
  End Property

End Class
Example using a Meridian Enterprise VB.NET extension
Private Sub btnPublish_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
  Handles btnPublish.Click

  Dim publisherQueue As Object = Nothing
  ' Get the current document to publish.
  Dim document As BCDocument = ExtensionHost.CurrentObject

  Dim vaultId = String.Format( _
    "\\{0}\{1}", _
    ExtensionHost.Repository.AMServer.Address, _
    ExtensionHost.Repository.DataStoreName)

  Try
    ' Create the publisher object.
    ' Add a second parameter set to True to create the object on the server instead
    ' if automatic downloads to client computers are prohibited.
    publisherQueue = CreateObject("BCPublisher.MeridianQueue")

    ' Register the document for publishing.
    publisherQueue.RegisterDocument( _ 
      vaultId, "3BA9DF", document.ID, , , , , , "Custom.PublishStatus")

  Finally
    ' If the object was initialized, dispose explicitly.
    If publisherQueue IsNot Nothing Then
      publisherQueue.Dispose()
      publisherQueue = Nothing
    End If
  End Try
End Sub
Example using a Meridian Enterprise VB.NET application
Private Sub DoIt(ByVal repository As BCRepository)
  Dim publisherQueue As Object = Nothing

  ' Get document to publish.
  Dim document As BCDocument = repository.GetFSObject("\MyDocument.doc")
  ' Compile the vault identifier.
  Dim vaultId = String.Format("\\{0}\{1}", repository.AMServer.Address, repository.DataStoreName)

  Try
    ' Create the publisher object.
    publisherQueue = CreateObject("BCPublisher.MeridianQueue")

    ' Register the document for publishing.
    publisherQueue.RegisterDocument( _ 
      vaultId, "3BA9DF", document.ID, , , , , , "Custom.PublishStatus")

  Finally
    ' If the object was initialized, dispose explicitly.
    If publisherQueue IsNot Nothing Then
      publisherQueue.Dispose()
      publisherQueue = Nothing
    End If
  End Try
End Sub

Related concepts

Registering documents for publication

Related tasks

Registering on demand in Meridian Enterprise

Registering programmatically with the Task Server


Copyright © 2000-2012 BlueCielo ECM Solutions

www.bluecieloecm.com